<?php
/**
 * Created by PhpStorm.
 * User: jwb
 * Date: 2021/4/1
 * Time: 10:56
 */

namespace App\Extensions\Tools;


use App\Models\AdminUser;
use Illuminate\Database\Eloquent\Collection;

class GoodsOffSaleBatch extends BatchAction
{
    protected $selector = '.off-sale-posts';

    public function handle(Collection $collection)
    {
        foreach ($collection as $model) {
            if ($model->review_status == 1) {
                $model->sale_status = 3;
                $model->save();
            }
        }
        return $this->response()->swal()->success('操作成功!')->refresh();
    }

    public function name()
    {
        return "<a class='off-sale-posts btn btn-sm btn-dropbox'><i class='fa fa-level-down'></i>&nbsp;下架</a>";
    }
}